﻿using System.Windows.Forms;
using Components.Enum;
using UI.StorageManagement;

namespace UI.BuyManagement
{
    public partial class FrmAcceptAdjustMain : UI.ParentForm.BaseMain
    {
        FrmAcceptAdjust edit = null;

        public FrmAcceptAdjustMain(string modulecode, string action)
            : base(modulecode, action)
        {
            InitializeComponent();
        }

        protected override void AddToolButton()
        {
            tspAdd.Text = "新增调整";
        }

        protected override void OnViewClick(ToolStripButton btn, DataGridViewRow row)
        {
            if (null == row) return;

            edit = new FrmAcceptAdjust(this.ModuleCode, "V", Components.Validation.ToString(row.Cells["listid"].Value));

            edit.ShowDialog();
        }

        protected override void OnAddClick(ToolStripButton btn)
        {
            edit = new FrmAcceptAdjust(this.ModuleCode, "A");

            edit.ShowDialog();
            if (edit.IsReload) base.BindGrid();
        }

        protected override void UpdatePager(UI.Common.Pager pager)
        {
            pager.FilterAppName = "f.usercode";
            pager.StrWhere = string.Format(" f.doctype = '{0}' ", DocumentType.AcceptAdjust);
        }
    }
}
